{include file="public/headerbase" /}
{include file="public/left" /}
<div class="right-content">
<ul class="we7-page-tab">
	<li class="active">品牌展示</li>
</ul>
<div class="clearfix">
	<form action="" method="get" class="we7-form" role="form">
	<div class="input-group pull-left col-sm-4">
		<input type="text" name="gtitle" id="gtitle" value="" class="form-control" placeholder="搜索商品名称"/>
		<span class="input-group-btn"><button class="btn btn-default" onclick="sear()"><i class="fa fa-search">搜索</i></button></span>
	</div>
		<div class="form-group">
			<div class="pull-right">
				<a href="{:url('Goods/addlist')}" class="btn btn-primary">添加商品</a>
			</div>
		</div>
	</form>
	
	<table class="table we7-table table-hover">
		<col width="90px"/>
		<col width="100px"/>
		<col width="100px"/>
		<col width="100px"/>
		<col width="100px"/>
		<col width="100px"/>
		<col width="90px"/>
		<col width="120px"/>
		<tr>
			<th>排序</th>
			<th>商品标题</th>
			<th>商品品牌</th>
			<th>商品类别</th>
			<th>商品规格</th>
			<th>商品库存</th>
			<th>商品运费</th>
			<th>操作</th>
		</tr>
		{foreach name="goods" item="val"}
		<tr>
			<th><span>{$val.gid}</span></th>
			<th><span>{$val.gtitle}</span></th>
			<th><span>{$val.bname}</span></th>
			<th><span>{$val.cname}</span></th>
			<th><span>{$val.gspec}</span></th>
			<th><span>{$val.goodsnum}</span></th>
			<th><span>{$val.gfare}</span></th>
			<th>
				<span class="link-group">
					<a href="{:url('Goods/update')}?gid={$val.gid}">编辑</a>
					<a href="javascript:;" class="del" onclick="del(this,{$val.gid})">删除</a>
				</span>
			</th>
		</tr>
		{/foreach}
	</table>
	
	<div class="pull-right">
	{$page}
			</div>
</div>
			</div>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
	function sear(){
		var gtitle=$('#gtitle').val();
			$.ajax({
	        url: "{:url('Goods/index')}",
	        data:{'gtitle':gtitle},
	        type: "post",
	        dataType: "json",
	        success: function (me) {
	        }
    	});
	}
	function del(obj,gid){
		if(!confirm('确定删除吗')){
			return false;
		}
		$.ajax({
	        url: "{:url('Goods/del')}",
	        data:{'gid':gid},
	        type: "post",
	        dataType: "json",
	        success: function (mega) {
	          if(mega==1){
	           		obj.parentNode.parentNode.parentNode.remove();
	           }else{
	           		util.message('删除失败', '', '');
	           }
	        }
    	});
	}
</script>
{include file="public/footer" /}